<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'account.label', default: 'Account')}"/>
    <title>新增机构</title>
</head>

<body class="fixed-navbar fixed-sidebar">
<div class="small-header transition animated fadeIn">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>贷款管理系统</li>
                    <li><g:link controller="account" action="index">机构</g:link></li>
                    <li class="active">
                        <span>新增机构</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                新增机构
            </h2>
        </div>
    </div>
</div>

<div class="content animate-panel">
    <div class="row">
        <div class="hpanel hyellow">
            <div class="panel-heading">
                新增机构
            </div>

            <div class="panel-body">
                <g:if test="${flash.message}">
                    <div class="message" role="status">${flash.message}</div>
                </g:if>
                <g:hasErrors bean="${this.account}">
                    <ul class="errors" role="alert">
                        <g:eachError bean="${this.account}" var="error">
                            <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message
                                    error="${error}"/></li>
                        </g:eachError>
                    </ul>
                </g:hasErrors>
                <g:form action="save" class="form-horizontal">

                <div class="form-group">
                  <g:textField name="type.id" value="${com.next.AccountType.findByName('机构')?.id}" class="hide"/>
                    <label class="col-md-3 control-label">上级机构</label>

                    <div class="col-md-3"><g:select name="parent.id" value="${this.account?.parent?.id}"
                                                    from="${com.next.Account.findAllByType(com.next.AccountType.findByName('机构'))}" optionKey="id"
                                                    optionValue="name" class="form-control" noSelection="${['null': '请选择']}"/></div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">机构等级</label>

                    <div class="col-md-3"><g:select name="level.id" value="${this.account?.level?.id}"
                                                    from="${com.next.AccountLevel.findAllByType(com.next.AccountLevelType.findByName('机构等级'))}" optionKey="id"
                                                    optionValue="name" class="form-control" noSelection="${['null': '请选择']}"/></div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">机构编号</label>

                    <div class="col-md-3"><g:textField name="code" value="${this.account?.code}"
                                                       class="form-control"/></div>
                </div>
                    <div class="form-group">
                        <label class="col-md-3 control-label">机构简称</label>

                        <div class="col-md-3"><g:textField name="name" value="${this.account.name}"
                                                           class="form-control"/></div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-3 control-label">地址</label>

                        <div class="col-md-3"><g:textField name="officeAddress" value="${this.account.officeAddress}"
                                                           class="form-control"/></div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-3 control-label">状态</label>

                        <div class="col-md-3">
                            <div class="radio radio-info radio-inline">
                                <input type="radio" name="active"  value="true" checked="">
                                <label for="radio1">启用</label>
                            </div>

                            <div class="radio radio-info radio-inline">
                                <input type="radio" name="active"  value="false">
                                <label for="radio2">禁用</label>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-3 col-md-offset-3">
                            <g:submitButton class="btn btn-info" name="create" value="保存"/>
                        </div>
                    </div>
                </g:form>
            </div>
        </div>
    </div>
</div>


</body>
</html>
